// ignore_for_file: prefer_const_constructors, use_key_in_widget_constructors

import 'package:easy_rich_text/easy_rich_text.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tiktokadult/assets_tool/app_colors.dart';
import 'package:tiktokadult/hj_utils/widget_utils.dart';
import 'package:tiktokadult/tools_base/widget/common_dialog.dart';

import '../../hj_model/splash/domain_source_model.dart';

/// 系统公告--文字公告
class SystemWordDialog extends StatelessWidget {
  const SystemWordDialog({
    this.content,
    this.addr,
    this.wordBean,
  });

  final AnnounceInfoBean? wordBean;
  final String? content;
  final String? addr;

  @override
  Widget build(BuildContext context) {
    return CommonDialog(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(
            wordBean?.title ?? "官方公告",
            style: TextStyle(
              fontSize: 20,
              color: Colors.white.withOpacity(0.9),
              fontWeight: FontWeight.w500,
            ),
          ),
          12.sizeBoxH,
          0.5.line,
          12.sizeBoxH,
          SizedBox(
            height: 220,
            child: SingleChildScrollView(
              child: EasyRichText(
                content ?? "",
                defaultStyle: TextStyle(color: Color(0xff656565), fontSize: 12, height: 25 / 12),
                patternList: [
                  EasyRichTextPattern(
                    targetString:
                        '(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)|https:\/\/t\\.me\/[0-9A-Za-z]{2,256}',
                    urlType: 'web',
                    style: TextStyle(
                      decoration: TextDecoration.underline,
                      color: Colors.blue,
                    ),
                  ),
                ],
              ),
            ),
          ),
          12.sizeBoxH,
          InkWell(
            onTap: () => Get.back(),
            child: Container(
              alignment: Alignment.center,
              height: 44,
              decoration: BoxDecoration(borderRadius: BorderRadius.circular(3), color: AppColors.actionRed),
              child: Text(
                "我知道了",
                style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
